home *** CD-ROM | disk | FTP | other *** search
- #include <exec/exec.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- void sr(char *s);
-
- char InF[200];
- char InF1[200];
- char OutF[200];
- main(int argc,char *argv[])
- {
- char image1[150],image2[150];
- int broke=0;
- int count=1;
- FILE *fi,*fi2,*fo;
- if(argc!=3)
- {
- printf("Index version 1.0, written by Joseph Hodge\n");
- printf("usage: Index <indexname> <form>\n");
- exit(0);
- }
- strcpy(InF,argv[1]); sr(InF);
- strcpy(InF1,argv[2]); sr(InF1);
- sprintf(OutF,"%s.fin",InF);
-
- fi=fopen(InF,"r");
- if(fi==NULL)
- {
- printf("Error, can't open file %s\n",InF);
- exit(0);
- }
- fo=fopen(OutF,"w");
- while(fgets(image1,150,fi)!=NULL)
- {
- fprintf(fo,"\n");
- fprintf(fo," AMIEXPRESS VALIDATION FORM 1.0 \n");
- fprintf(fo,"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= \n");
-
- printf("Processing Image %d\n",count++);
- fi2=fopen(InF1,"r");
- if(fi2==NULL)
- {
- printf("Error, can't open file %s\n",InF1);
- fclose(fi);
- exit(0);
- }
- while(fgets(image2,150,fi2)!=NULL)
- {
- sr(image2);
- if(!strnicmp(image1,image2,39))
- {
- fprintf(fo,"%s\n",image2);
- while(fgets(image2,150,fi2)!=NULL)
- {
- sr(image2);
- if(strstr("AMIEXPRESS VALIDATION FORM",image2)){ broke=1;break; }
- fprintf(fo,"%s\n",image2);
- broke=0;
- }
- break;
- }
- }
- fclose(fi2);
- }
- fclose(fi);
- fclose(fo);
- exit(0);
- }
-
- void sr(char *s)
- {
- register int i;
- i=strlen(s)-1;
- while(i>-1)
- {
- if(*(s+i)<=32) *(s+i)='\0'; else break;
- i--;
- }
- }